import mitt from "mitt";
const emitter = mitt();
const eventBus = {
  // 支付完成
  payed: {
    emit: (e: any = '') => {
      emitter.emit('payed', e);
    },
    on: (callback: any = '') => {
      emitter.on('payed', (e) => callback(e));
    },
    off: () => {
      emitter.off('payed');
    }
  },
  //登录失效
  loginLose: {
    emit: (e: any = '') => {
      emitter.emit('loginLose', e);
    },
    on: (callback: any = '') => {
      emitter.on('loginLose', (e) => callback(e));
    },
    off: () => {
      emitter.off('loginLose');
    }
  },
}
export default eventBus;